<template>
	<view class="mainpadding" v-if="pageShow">
		<view class="toububjt flexcolumn">
			<view class="bigbtext">{{userInfo.money}}</view>
			<view class="xbtext">我的余额</view>
			<view class="flexcenter margin_top">
				<view class="baibtn margin_right" @click="jumpurl('/pages/mine/chongzhi')">充值</view>
				<view class="baibtn" @click="jumpurl('/pages/mine/tixian')">提现</view>
			</view>
		</view>
		<view class="dingwei margin_top">
			<view class="titletext bold hei_text">余额明细</view>
			<view class="lan_img"></view>
		</view>
		<view class="flexcenter" v-if="!list.data.length">
			<view class="placeholderimage"  style="margin-top: 100rpx;"></view>
		</view>
		<view class="ffffff mainpadding_top radius" v-if="list.data.length">
			<view class="xiahuax" v-for="item in list.data" :key="item.id">
				<view class="flexbetween">
					<view class="ershib1">{{item.memo}}</view>
					<view class="qianshu">{{item.money}}</view>
				</view>
				<view class="margin_top qhtext">{{item.createtime_text}}</view>
			</view>
		</view>

	</view>
</template>
<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				userInfo: {},
				page: 1,
				limit: 12,
				list: {
					data: []
				},
				pageShow:false
				
			}
		},
		onShow() {
			this.init() //用户信息
			this.yuelist() //余额明细
			
		},
		methods: {
			init() { //用户信息
				httpRequest.request('/api/user/index', 'GET', {}, false, false, true).then(res => {
					if (res.code == 1) {
						this.userInfo = res.data
						this.pageShow = true
					}
				}).catch(err => {
					httpRequest.toast(err.msg);
				})
			},
			
			yuelist(isPage, page) { //积分明细列表
				let _this = this;
				httpRequest.request('/api/user/getUserMoneyLog', 'GET', {
					page: page || 1,
					limit: _this.limit,
				}).then(res => {
					if (res.code == 1) {
						let resList = res.data.data;
						if (isPage == true) {
							// _this.listtj.data = _this.listtj.data.concat(resList);
							_this.list.data.push(...resList);
						} else {
							_this.list = res.data;
							_this.list.data = resList;
						}
					}
				})
			},
			// 
			onReachBottom() { //页面触底加载，上拉加载
				let _this = this;
				let list = _this.list;
				let page = _this.page;
				if (list.last_page <= page) {
					return false;
				}
				page++;
				_this.page = page;
				_this.init(true, page);
			},
			jumpurl(url) {
				uni.navigateTo({
					url
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.xian {
		width: 22rpx;
		height: 0rpx;
		background-color: #999999;
		border: 1rpx solid #999999;
	}

	.shijianbtn {
		padding: 20rpx 65rpx;
		background: #F7F9FA;
		border-radius: 41rpx;
		font-size: 28rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #999999;
	}

	.huisebtn {
		width: 198rpx;
		height: 80rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		font-size: 28rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #999999;
		background: #F7F9FA;
		border-radius: 41rpx;
	}

	.haungsebtn {
		width: 198rpx;
		height: 80rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		font-size: 28rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #3478F5;
		background: rgba(250, 181, 54, .1);
		border-radius: 41rpx;
	}

	.sanshi {
		width: 33.33%;
	}

	.xiahuax {
		margin-top: 30rpx;
		padding-bottom: 30rpx;
		border-bottom: 2rpx solid rgba(0, 0, 0, 0.03);
	}

	.xiahuax:first-child {
		margin-top: 0rpx;
	}

	.xiahuax:last-child {
		padding-bottom: 0rpx;
		border-bottom: none;
	}

	.qhtext {
		font-size: 24rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #999999;
	}

	.qianshu {
		font-size: 32rpx;
		font-family: DIN Next LT Pro-Bold, DIN Next LT Pro;
		font-weight: bold;
		color: #3478F5;
	}

	.ershib1 {
		font-size: 28rpx;
		font-family: PingFang SC-Heavy, PingFang SC;
		font-weight: 800;
		color: #333;
	}


	.zhtext {
		font-size: 24rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #fff;
	}

	.banju {
		padding: 30rpx 30rpx 20rpx;
	}

	.line {
		width: 100%;
		border: 1rpx solid rgba(255, 255, 255, .1);
	}

	.baibtn {
		width: 194rpx;
		height: 65rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		border-radius: 10rpx;
		border: 2rpx solid #FFFFFF;
		font-size: 28rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #fff;
	}

	.xbtext {
		font-size: 36rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #fff;
	}

	.bigbtext {
		font-size: 80rpx;
		font-family: DIN Next LT Pro-Bold, DIN Next LT Pro;
		font-weight: bold;
		color: #fff;
	}

	.toububjt {
		background-size: 100% 100%;
		width: 100%;
		box-sizing: border-box;
		padding: 76rpx 0 20rpx;
		background-image: url('@/static/image/system/jjtb.png');
	}
</style>